﻿Imports System.Reflection
Imports MostRecentlyUsed.My

Public Class frmRevisionInfo
    Public Shared Function IsNewVersion() As Boolean
        Dim szVersion As String = Assembly.GetExecutingAssembly().GetName().Version.ToString()
        Return szVersion <> MySettings.Default.LastRevisionInfo
    End Function

    Public Shared Sub DisplayRevisionInfo(parentForm As Form)
        Dim szVersion As String = Assembly.GetExecutingAssembly().GetName().Version.ToString()
        If szVersion <> MySettings.Default.LastRevisionInfo Then
            MySettings.Default.LastRevisionInfo = szVersion
            MySettings.Default.Save()

            Using oRevision As frmRevisionInfo = New frmRevisionInfo()
                oRevision.ShowDialog(parentForm)
            End Using
        End If
    End Sub

    Private Sub frmRevisionInfo_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
        Try
            If (e.KeyCode = Keys.Escape) Then
                DialogResult = DialogResult.OK
                Close()
            End If
        Catch
        End Try
    End Sub

    Private Sub txtResults_KeyDown(sender As Object, e As KeyEventArgs) Handles txtResults.KeyDown
        Try
            If (e.KeyCode = Keys.Escape) Then
                DialogResult = DialogResult.OK
                Close()
            End If
        Catch
        End Try
    End Sub

    Private Sub frmRevisionInfo_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
        Try
            txtResults.DeselectAll()
        Catch
        End Try
    End Sub
End Class